package com.eshop.pojo;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * 用户表(User)表实体类
 *
 * @author makejava
 * @since 2024-01-17 11:35:24
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuppressWarnings("serial")

public class User extends Model<User> implements UserDetails {
    //用户id
    private Integer id;
    //用户名
    private String username;
    //密码
    private String password;
    //是否可用，1表示可用，0表示不可用
    private Integer enabled;
    @TableField(exist = false)
    List<GrantedAuthority> authorities;
    @TableField(exist = false)
    List<Menu> menus;

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}

